<?php 
include 'functions.php';
sec_session_start();
// Elimina tutti i valori della sessione.
$_SESSION = array();
// Recupera i parametri di sessione.
$params = session_get_cookie_params();
// Cancella i cookie attuali.
setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
// Cancella la sessione.
setcookie("login_string", '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
setcookie("username", '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
setcookie("user_id", '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
session_destroy();
header('Location: login.php');
?>